package com.interagriculture.service.impl;

import com.interagriculture.entity.Carousel;
import com.interagriculture.mapper.CarouselMapper;
import com.interagriculture.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

@Service
public class CarouselServiceImpl implements CarouselService {

    @Autowired
    private CarouselMapper carouselMapper;
    /**
     * 获取轮播图
     */
    public List<Carousel> getImage(Carousel carousel) {
        List<Carousel> list;
        list = carouselMapper.getImageById(carousel.getId());

        return list;
    }

    /**
     * 修改轮播图
     * @param carousel
     */
    public void updateImage(Carousel carousel) {
        Integer id = carousel.getId();
        String image = carousel.getImage();
        carouselMapper.updateImage(id,image);
    }
}
